#ifndef SAGEVISTEXTLABEL_H
#define SAGEVISTEXTLABEL_H

#include <QObject>
#include <QObject>
#include <QPointer>
#include <QGraphicsProxyWidget>
#include <QLabel>
#include <QString>
#include <QRectF>

#include "../sagevis.h"
#include "../VisBaseClasses/visbaseelement.h"
#include "../VisBaseClasses/visbasewidget.h"

class SageVisTextLabel : public VisBaseElement
{
    Q_OBJECT
public:

    explicit SageVisTextLabel(QPointer<SageVis> sageVisPointer, QPointer<VisBaseWidget> parentWidget, QGraphicsItem *parent = 0);
    explicit SageVisTextLabel( QString text, QPointer<SageVis> sageVisPointer, QPointer<VisBaseWidget> parentWidget, QGraphicsItem *parent = 0);

    typedef VisBaseElement super;

    //static const QPainter staticPainter;

    //SHAPE AND SIZE FUNCTIONS
    void setGeometry(const QRectF &geom);
    void setGeometry( qreal x, qreal y, qreal w, qreal h );
    //QRectF boundingRect() const;
//    QPainterPath shape() const;
    //QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;

    //PAINT FUNCTIONS
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);


    //TEXT FUNCTIONS
    void setText(QString text);
    int getTextWidth();
    void setLabelWidth(int labelWidth);

    QString getUniqueId();

signals:
    
public slots:

private:
     QString textString; /*< text to display*/
     QString uniqueId;
     //bool hovering;

     //TEXT ATTRIBUTES
     int savedFontSize;
     int textWidth;
     int labelWidth;
     float defaultHeight;
     float maximizedHeight;
     QFont* font;
     QGraphicsRectItem* behindTextRect;

     void init(QString text);
     void setupText();
     //void setUniqueId(QString id);

     void processHoverEvent(QGraphicsSceneHoverEvent *event);//for when text label is hovered over
     void receiveHoverEvent(QGraphicsSceneHoverEvent *event); //for when another connected object is hovered over
    
     void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
     void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
};

#endif // SAGEVISTEXTLABEL_H
